package org.karelun.whiteboard.edit.properties;

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.karelun.whiteboard.Named;
import org.karelun.whiteboard.gef.EditPart;

/**
 * @Author: KarelunHuang
 * @Date: Jan 30, 2013
 **/
public class WhiteboardTabbedSheetPageLabelProvider extends LabelProvider {

	@Override
	public String getText(Object element) {
		if(element instanceof IStructuredSelection){
			Object ele = ((IStructuredSelection)element).getFirstElement();
			if(ele instanceof EditPart){
				Object model = ((EditPart)ele).getModel();
				if(model instanceof Named){
					return ((Named)model).getName();
				}
			}
		}
		return super.getText(element);
	}

}
